package com.woniuxy.sddfp.system.controller;


import com.woniuxy.sddfp.common.exception.BusinessException;
import com.woniuxy.sddfp.common.result.Result;
import com.woniuxy.sddfp.common.result.enums.impl.BusinessCode;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author yellow doctor
 * @since 2025-05-06
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @GetMapping("/hello")
    public String hello(){
        return "hello springboot";
    }

    @GetMapping("/test1/{id}")
    public Result test1(@PathVariable Integer id){
        if (id == 1){
            throw new BusinessException(BusinessCode.Fail);
        }
        return Result.ok("昨天买了彩票中了2000w");
    }
}
